{% extends 'index.html' %}
{% load static %}

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>title</title>
    <link href="{% static 'bootstrap-3.3.7-dist/css/bootstrap.min.css' %}" rel="stylesheet">

</head>

<body>

{% block title %}
    <span class="navbar-page-title"> JSXQ知识百科 - 百科模板 - 添加 </span>
{% endblock %}


{% block content %}

    <div class="wiki-add-edit" style="margin: 20px;background-color: #ffffff;padding:20px">

        <form action="{% url 'add_wikipedia_template' %}" method="post">
            {% csrf_token %}
            <input type="text" name="all_tem" style="display: none;" value="{{ template_content }}">

            <div class="row" style="margin-bottom: 30px">
                <div class="col-xs-6 col-md-4">
                    <div class="span-div" style="color:#333333;line-height: 38px;">百科模板名称</div>
                </div>
                <div class="col-xs-12 col-md-4">
                    <input type="text" name="name" class="form-control" required>
                </div>
            </div>



            <div class="row" style="margin-bottom: 30px">
                <div class="col-xs-6 col-md-4">
                    <div class="span-div" style="color:#333333;line-height: 38px;">百科模板内容</div>
                </div>
                <div class="col-xs-12 col-md-4">
                    <textarea class="form-control" name="content" rows="3" required></textarea>

                </div>
                <div class="col-xs-12 col-md-4">
                    <span style="color: #e6a23c;line-height: 38px;"> （百科模板内容之间请用中文逗号分隔开） </span>
                </div>
            </div>


            <div class="row" style="margin-bottom: 30px">
                <div class="col-xs-6 col-md-4">
                    <div class="span-div" style="color:#333333;line-height: 38px;">关联知识卡片模板</div>

                </div>
                <div class="col-xs-12 col-md-4">
                    {% for sg_card in card_list %}

                        <div class="checkbox" style="width: 48%;display: inline-block">
                            <label><input name='card_template' type="checkbox" style="color: #333333"
                                          value="{{ sg_card.id }}" required>{{ sg_card.name }}</label>
                        </div>
                    {% endfor %}

                </div>
            </div>


            <div class="row">
                <div class="col-xs-6 col-md-4">
                </div>
                <div class="col-xs-12 col-md-4">
                    <div style="width: 49%;float: left">
                        <button type="submit" class="my-btn" style="margin-right: 20px">提交</button>
                    </div>
                    {#                    <a class='my-btn' style="display: inline-block" href="javascript:history.back(-1);" >取消</a>#}
                    <div style="width: 49%;float: left">

                        <button type="button" class="my-btn" onclick="getBackOne()">取消</button>
                    </div>

                </div>
            </div>

        </form>
    </div>

{% endblock %}

{% block myjs %}
    <script>
        document.getElementById("jsxqzsbk").style.display = 'block';
        document.getElementById("bkmb").style.backgroundColor = 'rgba(30,21,21,0.44)';

        /**
         * 取消按钮，返回上一页
         */
        function getBackOne() {
            history.back(-1)
        }
    </script>
    <script type="text/javascript" src="{% static 'js/textareaAutoHeight.js' %}"></script>
{% endblock %}